package cn.healthlink.study.controller;

import com.alibaba.nacos.api.config.annotation.NacosValue;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author dengzhiyuan
 * @version 1.0
 * @time 2020/10/20 15:15
 */
@Controller
@RequestMapping("config")
public class ConfigController {

    @NacosValue(value = "${useLocalCache:false}", autoRefreshed = true)
    private boolean useLocalCache;

    @NacosValue(value = "${name:me}", autoRefreshed = true)
    private String name;

    @GetMapping("/get")
    @ResponseBody
    public boolean get() {
        return useLocalCache;
    }

    @GetMapping("/name")
    @ResponseBody
    public String name() {
        return name;
    }

}
